﻿@model Zor_Web.Models.Warning.V_SearchPay
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>税收明细查询</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 日期选择器 -->
    <script src="~/Content/laydate/laydate.js"></script>

</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">
        <div class="col-sm-12 ct-padding">
            <div class="col-sm-9 ct-padding">
                <button id="btnSearch" class="layui-btn layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span> 查询</button>
                <button id="btnExport" class="layui-btn layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-share"></span> 导出</button>
                <button id="btnReplace" class="layui-btn layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-refresh"></span> 刷新</button>               
            </div>
        </div>
        <div class="layui-tab-content" style="overflow-x: scroll; white-space: nowrap;">
            <table class="layui-table" lay-skin="line">

                <thead>
                    <tr>
                        <th>楼宇</th>
                        <th>单元</th>
                        <th>房间</th>
                        <th>业主姓名</th>
                        <th>身份证号</th>
                        <th>业主电话</th>
                        <th>性别</th>
                        <th>交税金额(元)</th>
                        <th>税起时间</th>
                        <th>税止时间</th>
                        <th>交税日期</th>
                        <th>租金(元/月)</th>
                        <th>房屋性质</th>
                        <th>房屋面积</th>
                    </tr>
                </thead>
                <tbody id="accordion">
                    @foreach (var item in Model.PageData)
                    {
                        <tr>
                            <td>@item.Bd_Name</td>
                            <td>@item.Uim_Name</td>
                            <td>@item.Hs_Number</td>
                            <td>@item.NatPer_Name</td>
                            <td>@item.NatPer_IDNumber</td>
                            <td>@item.NatPer_Phone</td>
                            <td>@item.NatSex</td>
                            <td>@(item.PtActualTax*0.01)</td>
                            <td>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            @if (item.Pt_Date != null)
                            {
                                <td>@TimeHelper.TimeStampToDateTime(item.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td></td>
                            }
                            <td>@(item.LeaseRent*0.01)</td>
                            <td>@item.Nature</td>
                            <td>@item.Hs_Proportion㎡</td>
                        </tr>
                    }

                </tbody>

            </table>
        </div>
        <div class="col-sm-12">
            <div class="col-sm-10">
                @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
            </div>
            <div class="col-sm-2 to-righjt">
                共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
            </div>
        </div>
    </div>
    <!-- 导出模态 -->
    <form action="/Warning/ExportSearchPay" enctype="multipart/form-data" method="post" id="formDownload">
        <div id="exportHtml" style="display:none;">
            <div class="eh_wrap">
                <div class="eh_head">
                    <p style="">请选择您要导出的数据列</p>
                </div>
                <table width="100%" cellpadding="5" cellspacing="0">
                    <tr>
                        <td><input id="Bd_Name" type="checkbox" value="楼宇名称" name="chk_list" checked="checked" /><label>楼宇名称</label></td>
                        <td><input id="Uim_Name" type="checkbox" value="单元名称" name="chk_list" checked="checked" /><label>单元名称</label></td>
                        <td><input id="Hs_Number" type="checkbox" value="房号" name="chk_list" checked="checked" /><label>房号</label></td>
                        <td><input id="NatPer_Name" type="checkbox" value="业主姓名" name="chk_list" checked="checked" /><label>业主姓名</label></td>
                        
                    </tr>
                    <tr>
                        <td><input id="NatPer_IDNumber" type="checkbox" value="身份证号" name="chk_list" checked="checked" /><label>身份证号</label></td>
                        <td><input id="NatPer_Phone" type="checkbox" value="业主电话" name="chk_list" checked="checked" /><label>业主电话</label></td>
                        <td><input id="NatSex" type="checkbox" value="业主性别" name="chk_list" checked="checked" /><label>业主性别</label></td>
                        <td><input id="PtActualTax" type="checkbox" value="交税金额" name="chk_list" checked="checked" /><label>交税金额</label></td>

                    </tr>
                    <tr>
                        <td><input id="Acceptance_TaxStartTime" type="checkbox" value="交税开始时间" name="chk_list" checked="checked" /><label>交税开始时间</label></td>
                        <td><input id="Acceptance_TaxEndTime" type="checkbox" value="交税截止时间" name="chk_list" checked="checked" /><label>交税截止时间</label></td>
                        <td><input id="Pt_Date" type="checkbox" value="交税时间" name="chk_list" checked="checked" /><label>租赁截止时间</label></td>
                        <td><input id="LeaseRent" type="checkbox" value="租金" name="chk_list" checked="checked" /><label>租金</label></td>
                    </tr>
                    <tr>
                        <td><input id="Nature" type="checkbox" value="房屋性质" name="chk_list" checked="checked" /><label>房屋性质</label></td>
                        <td><input id="Hs_Proportion" type="checkbox" value="房屋面积" name="chk_list" checked="checked" /><label>房屋面积</label></td>
                    </tr>
                </table>
                <div class="box-footer">
                    <button type="submit" id="btnExportSure" class="btn btn-info pull-right">
                        <i class="fa fa-repeat"></i>导出
                    </button>
                    <input type="hidden" id="SearchPayMeg" name="SearchPayMeg" value="" />
                    <input type="hidden" id="where" name="where" value="" />
                </div>
            </div>
        </div>
    </form>


    @using (Html.BeginForm("SearchPay", "Warning", new RouteValueDictionary { { "Model", Model } }, FormMethod.Get))
    {
    <!-- 查询模态框 -->
        <div id="myModalSearch" hidden data-backdrop="static">
            <div id="divfrom" class="layui-tab-content">
                <form class="form-horizontal m-t">
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">楼宇名称：</label>
                        <div class="col-sm-9">
                            <input id="Bd_Name" type="text" class="form-control" name="Bd_Name" value="@Model.Bd_Name">

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">单元名称：</label>
                        <div class="col-sm-9">
                            <input id="Uim_Name" type="text" class="form-control" name="Uim_Name" value="@Model.Uim_Name">

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">房号：</label>
                        <div class="col-sm-9">
                            <input id="Hs_Number" type="text" class="form-control" name="Hs_Number" value="@Model.Hs_Number">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">业主姓名：</label>
                        <div class="col-sm-9">
                            <input id="NatPer_Name" type="text" class="form-control" name="NatPer_Name" value="@Model.NatPer_Name">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">身份证号：</label>
                        <div class="col-sm-9">
                            <input id="NatPer_IDNumber" type="text" class="form-control" name="NatPer_IDNumber" value="@Model.NatPer_IDNumber">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">业主性别：</label>
                        <div class="col-sm-9">
                            <select name="NatSex" class="form-control">
                                <option value="@Model.NatSex"></option>
                                <option value="@Model.NatSex">男</option>
                                <option value="@Model.NatSex">女</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">房屋面积：</label>
                        <div class="col-sm-9">
                            <input id="Hs_Proportion" type="text" class="form-control" name="Hs_Proportion" value="@Model.Hs_Proportion">

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">房屋性质：</label>
                        <div class="col-sm-9">
                            <select name="Nature" class="form-control">
                                <option value="@Model.Nature"></option>
                                <option value="@Model.Nature">商用</option>
                                <option value="@Model.Nature">民宅</option>
                                <option value="@Model.Nature">商住两用</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">交税金额：</label>
                        <div class="col-sm-9">
                            <input id="Pt_ActualTax" type="text" class="form-control" name="PtActualTax" value="@Model.PtActualTax">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">租金：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" name="LeaseRent" value="@Model.LeaseRent">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">交税开始日期：</label>
                        <div class="col-sm-9">
                            <input id="Search_StartTime" class="laydate-icon form-control layer-date" name="Acceptance_TaxStartTime" value="@Model.Acceptance_TaxStartTime">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">交税截止日期：</label>
                        <div class="col-sm-9">
                            <input id="Search_EndTime" class="laydate-icon form-control layer-date" name="Acceptance_TaxEndTime" value="@Model.Acceptance_TaxEndTime">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-3 layui-form-label">交税日期：</label>
                        <div class="col-sm-9">
                            <input id="Pt_Date" class="form-control layer-date laydate-icon" onclick="laydate({ istime: false, format: 'YYYY-MM-DD' })" name="Pt_Date" value="@Model.Pt_Date">
                        </div>
                    </div>

                </form>
                <div class="box-footer">
                    <button type="submit" class="btn btn-info pull-right">
                        <i class="fa fa-search"></i>查询
                    </button>
                </div>
            </div>
        </div>
    }
</body>
</html>
<script>
    
    /**
  *   日期选择器
  */

    laydate(
    { elem: "#Pt_Date", event: "focus" });

    laydate.skin('molv');         //日历皮肤
    var start = {                   //开始时间选择
        elem: "#Search_StartTime",
        format: "YYYY/MM/DD",
        min: '1900-01-01',
        max: "2099-06-16",
        istime: false,
        istoday: true,
        choose: function (datas) {
            end.min = datas;
            end.start = datas
        }
    };
    var end = {                     //结束时间选择
        elem: "#Search_EndTime",
        format: "YYYY/MM/DD",
        min: '1900-01-01',
        max: "2099-06-16",
        istime: false,
        istoday: true,
        choose: function (datas) { start.max = datas }
    };
    laydate(start);
    laydate(end);


    /**
    * 刷新
    **/
    $(function () {
        $("#btnReplace").click(function () {
            Replace();
        })
    })


    /**
   * 查询房屋
   */
    $(function () {
        $("#btnSearch").click(function () {
            ClearWebControls(divfrom);
            LayerOpen('640px', '700px', '房屋出租查询', $('#myModalSearch'));
        })
    })

    /*导出*/
    $("#btnExport").click(function () {
        layer.open({
            type: 1,
            title: '导出提示',
            shade: false,
            skin: 'layui-layer-rim',
            area: ['620px', '280px'], //宽高
            content: $('#exportHtml')
        });
    });

    /*导出交互*/
    $("#btnExportSure").click(function () {
        var arr = new Array();
        $("[name='chk_list']").each(function () {
            if ($(this).is(":checked")) {
                arr.push($(this).attr("id") + "|" + $(this).val());
            }
        });
        $("#SearchPayMeg").val(arr);
        document.getElementById('formDownload').submit();
        layer.closeAll();
    });
</script>